package com.baidu.mpks.user.service;

import com.baidu.mpks.user.domain.User;
import com.baidu.mpks.user.domain.UserSync;
import com.baidu.mpks.user.dto.UserResourcesResponse;
import com.baidu.mpks.user.vo.UserParam;
import com.baidu.mpks.usergroup.dto.Resources;
import org.apache.poi.ss.usermodel.Workbook;

import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Map;

public interface UserService {

    User login(String account, String password, boolean rememberMe) throws Exception;

    User findByAccount(String account);

    User findByUserId(String userId);

    Map<String, User> findByUserIds(List<String> userIds);

    List<User> findUserListByRoleId(String roleId, String status, String userName, String trueName, Integer pageNum, Integer pageSize);

    Map<String, Object> getUserRoleList(String roleId, String status, String userName, String trueName, Integer deptId, String startTime, String endTime, Integer pageNum, Integer pageSize);

    void updateUserStatus(User user);

    void deleteUser(User user);

    void updatePwdAndName(User user);

    void updatePwd(User user);

    void updateUserRoles(List<String> userIds, List<Integer> roleIds);

    User addUser(User user, String roleIds);

    void updateUser(UserParam userParam, String roleIds);

    User initUser(User user);

    User syncUser(UserSync userSync);

    void updateUserByUserId(User user, String roleIds);

    Map<String, Object> getDeptByUserId(String userId);

    List<User> getNoDeptUsers();

    List<Map<String, Object>> getDeptByUserIds(List<String> userId);

    UserParam getUserInfo(String userId) throws InvocationTargetException, IllegalAccessException;

    List<String> getOrderedTags(String userId);

    void updateOrderedTags(String userId, List<String> tags);

    void deleteOrderedTags(String userId);

    void addOrderedTags(String userId, List<String> tags);

    void deduplicationTags(@NotNull List<String> orderedTags, @NotNull List<String> departmentTags, @NotNull List<String> userTags);

    List<Resources> getResourcesByUserId(String userId, String type);

    UserResourcesResponse getAllResourcesByUserId(String userId, String type);

    void addResources(String userId, String type, List<Resources> resourcesList);

    void deleteResourcesById(String userId, String type, List<Integer> resourcesIds);

    void deleteResourcesByName(String userId, String type, List<String> resourcesNames);

    Integer findUserFirstLogin(String userId, String menu);

    void insertUserFirstLogin(String userId, String menu);

    void deleteUserFirstLogin(String userId);

    void deleteUserFirstLogin(String userId, String menu);

    int insertUserOrRole(String userId, List<Integer> roleIds);

    Map<Integer, Resources> getUserInheritRoles(String userId);

    List<Resources> getUserAllRoles(String userId);

    List<Integer> getUserAllRoleIds(String userId);

    void deleteResourcesByUserId(String userId, String type);

    void synShenFeiInfo();

    void exportDataToWorkbook(String roleId, String status, String userName, String trueName, Integer deptId, String startTime, String endTime, Workbook workbook);

    void downWorkBookToPC(HttpServletResponse response, Workbook workbook, String s) throws IOException;
}
